for fid in range(self.df.fid):
    gt_frames = self.gt[self.gt.fid == fid]
    tids = gt_frames.tid.tolist()
    gt_boxes = gt_frames.loc[:, ['x', 'y', 'w', 'h']].as_matrix()
    tmp_df = self.df[self.df.fid == fid]
    for i in range(len(tmp_df)):
        box, iid = self.df.box[i], self.df.iid[i]
        iou_scores = [iou(box, gt_box) for gt_box in gt_boxes]
        tid = tids[np.argmax(iou_scores)]
        self.df.loc[i, 'tid'] = tid
